package com.yix.admin.modules.system.entity;

import com.yix.common.base.BaseUUIDEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Objects;

/**
 * @author wdx
 * @version 1.0
 * @Description TODO
 * @date 2021/1/27 17:28
 */
@Entity
@Data
@Table(name="sys_job")
@org.hibernate.annotations.Table(appliesTo = "sys_job",comment = "岗位表")
public class SysJob extends BaseUUIDEntity implements Serializable {

    @NotBlank
    @Column(columnDefinition = "varchar(255) COMMENT '名称'",nullable = false)
    @ApiModelProperty(value = "名称")
    private String name;

    @NotNull
    @Column(columnDefinition = "int(20) COMMENT '排序'",nullable = true)
    @ApiModelProperty(value = "排序")
    private Integer sort;

    @NotNull
    @Column(columnDefinition = "bit(1) COMMENT '状态'",nullable = false)
    @ApiModelProperty(value = "状态")
    private Boolean enabled;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        SysJob job = (SysJob) o;
        return Objects.equals(id, job.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }

}
